#ifndef __PID_H_
#define __PID_H_

#define FAST_ZONE     30.0f  // 快速响应区阈值(度)
#define BRAKE_ZONE    10.0f  // 制动区阈值(度)
#define INTEGRAL_ACTIVATION_ERR  1.0f  // 积分激活阈值(度)
#define INTEGRAL_MAX           500.0f  // 积分限幅

typedef struct
{
  float kp;
	float ki;
	float kd;
	
	float target_value;//目标值
	float feedback_value;//返回值
	float err[2];//误差值
	
	float p_out;
	float i_out;
	float d_out;
	float out;

}pid_t;

typedef struct
{
	float last_angle;
	float total_angle;
}Angle_t;


void pid_init_s(pid_t *pid);
void pid_init_a(pid_t *pid);
void pid_calculate(pid_t *pid,float target,float current);


#endif
